<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        extends 可以让一个类继承另一个类的所有
      */
      class Person {
        say() {
          console.log("hello !");
        }
      }
      // User.prototype.__proto__= Person.prototype
      class User extends Person {
        // constructor() {
        // this = {}
        // this.__proto__ = User.prototype;
        // return this
        // }
      }
      const u = new User();
      u.say();

      /*
      Object.prototype = {
        __proto__: null,
      };

      Person.prototype = {
        __proto__: Object.prototype,
      };

      User.prototype = {
        __proto__: Person.prototype,
      };
      u = {
        __proto__: User.prototype,
      };
      */

      // console.log(User.prototype.__proto__ === Person.prototype);
    </script>
  </body>
</html>
